<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>EOS.IO: contracts/storage/storage.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="eos-logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">EOS.IO
   &#160;<span id="projectnumber">DAWN1.1.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_ae9b15dd87e066e1908bbd90e8f38627.html">contracts</a></li><li class="navelem"><a class="el" href="dir_322cd3c97a9c45f1dd8d138b04e20992.html">storage</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">storage.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="storage_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="eos_8hpp.html">eoslib/eos.hpp</a>&gt;</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="token_8hpp.html">eoslib/token.hpp</a>&gt;</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="db_8hpp.html">eoslib/db.hpp</a>&gt;</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#ifndef TOKEN_NAME</span></div><div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="storage_8hpp.html#a2bf6bf152ba93be8cace72c5d55abc71">   20</a></span>&#160;<span class="preprocessor">#define TOKEN_NAME TOK</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespace_t_o_k_e_n___n_a_m_e.html">TOKEN_NAME</a> {</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="group__storageapi.html#gabbe71e05a36e97f4844809600c08f432">   36</a></span>&#160;    <span class="keyword">typedef</span> <a class="code" href="structeos_1_1token.html">eosio::token&lt;uint64_t, N(storage)&gt;</a> <a class="code" href="group__storageapi.html#gabbe71e05a36e97f4844809600c08f432">StorageTokens</a>;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;   <span class="keyword">struct </span><a class="code" href="struct_t_o_k_e_n___n_a_m_e_1_1_transfer.html">Transfer</a> {</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;        <a class="code" href="group__types.html#gad67b43dc23285b01176f4c181c59fc23">AccountName</a> <a class="code" href="group__currencyapi.html#ga362f583628aa3e17ea756cb060a94779">from</a>;</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;        <a class="code" href="group__types.html#gad67b43dc23285b01176f4c181c59fc23">AccountName</a> <a class="code" href="group__currencyapi.html#ga75350616e02bd681c0e8b12ca4cf7a38">to</a>;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="group__storageapi.html#ga459112cbf883226edcb02b35a674ddcd">   57</a></span>&#160;        StorageTokens <a class="code" href="group__storageapi.html#ga459112cbf883226edcb02b35a674ddcd">quantity</a>; </div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;   };</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="group__storageapi.html#gaa4d95e1e82c4c995e09e400878511924">   63</a></span>&#160;   <span class="keyword">struct </span>PACKED(Account) {</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;      <a class="code" href="struct_t_o_k_e_n___n_a_m_e_1_1_account.html">Account</a>( StorageTokens b = <a class="code" href="group__storageapi.html#gabbe71e05a36e97f4844809600c08f432">StorageTokens</a>() ):balance(b),quotaused(0){}</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;      <span class="keyword">const</span> <a class="code" href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a> key = <a class="code" href="group__types.html#gaf9c1edb0e0da55ec6ba09f32f6839529">N</a>(account);</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;      StorageTokens balance;</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;      <a class="code" href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a> quotaused;</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;      <span class="keywordtype">bool</span>  isEmpty()<span class="keyword">const  </span>{ <span class="keywordflow">return</span> balance.<a class="code" href="structeos_1_1token.html#a3daddb64094c45d8f51897aabd44ba3d">quantity</a> == 0 &amp;&amp; quotaused == 0; }</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;   };</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;   static_assert( <span class="keyword">sizeof</span>(<a class="code" href="struct_t_o_k_e_n___n_a_m_e_1_1_account.html">Account</a>) == <span class="keyword">sizeof</span>(<a class="code" href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a>)+<span class="keyword">sizeof</span>(StorageTokens)+<span class="keyword">sizeof</span>(<a class="code" href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a>), <span class="stringliteral">&quot;unexpected packing&quot;</span> ); </div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;   <span class="keyword">using</span> <a class="code" href="struct_table.html">Accounts</a> = <a class="code" href="struct_table.html">Table&lt;N(storage),N(storage),N(account),Account,uint64_t&gt;</a>;</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;   <span class="keyword">inline</span> <a class="code" href="struct_t_o_k_e_n___n_a_m_e_1_1_account.html">Account</a> <a class="code" href="group__currencyapi.html#ga1de45851aa74bc1e9b4793dfe99717db">getAccount</a>( <a class="code" href="group__types.html#gad67b43dc23285b01176f4c181c59fc23">AccountName</a> owner ) {</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;      <a class="code" href="struct_t_o_k_e_n___n_a_m_e_1_1_account.html">Account</a> account;</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;      <a class="code" href="struct_table.html#a50bc5f57482c6a018e7eaf4e716e038c">Accounts::get</a>( account, owner );</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;      <span class="keywordflow">return</span> account;</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;   }</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;</div><div class="line"><a name="l00124"></a><span class="lineno"><a class="line" href="group__storageapi.html#ga7a45c6ffe0972cf0b36332888094d535">  124</a></span>&#160;   <span class="keyword">inline</span> <a class="code" href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a> <a class="code" href="group__storageapi.html#ga7a45c6ffe0972cf0b36332888094d535">getQuotaUsed</a>( <a class="code" href="group__types.html#gad67b43dc23285b01176f4c181c59fc23">AccountName</a> owner ) {</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;      <a class="code" href="struct_t_o_k_e_n___n_a_m_e_1_1_account.html">Account</a> account;</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;      <a class="code" href="struct_table.html#a50bc5f57482c6a018e7eaf4e716e038c">Accounts::get</a>( account, owner );</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;      <span class="keywordflow">return</span> account.quotaused;</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;   }</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;</div><div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="group__storageapi.html#gae28d4ae2e7427857dbae688d353fcba3">  133</a></span>&#160;  <span class="keyword">struct </span><a class="code" href="group__storageapi.html#gaa4d95e1e82c4c995e09e400878511924">PACKED</a>( Link ) {</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;      <a class="code" href="group__types.html#gad67b43dc23285b01176f4c181c59fc23">AccountName</a> owner;</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;      <span class="keywordtype">char</span>* eospath;</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;      </div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;      <span class="keywordtype">char</span>* ipfspath;</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;      <a class="code" href="group__types.html#ga06896e8c53f721507066c079052171f8">uint32_t</a> size;</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;      <a class="code" href="group__types.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> store;</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;      <a class="code" href="group__types.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> accept;</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;      <a class="code" href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a> stake;</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;      <a class="code" href="group__types.html#gad67b43dc23285b01176f4c181c59fc23">AccountName</a> producer;</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;  };</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;} </div><div class="ttc" id="group__types_html_gaba7bc1797add20fe3efdf37ced1182c5"><div class="ttname"><a href="group__types.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a></div><div class="ttdeci">unsigned char uint8_t</div><div class="ttdef"><b>Definition:</b> types.h:22</div></div>
<div class="ttc" id="group__types_html_gaf9c1edb0e0da55ec6ba09f32f6839529"><div class="ttname"><a href="group__types.html#gaf9c1edb0e0da55ec6ba09f32f6839529">N</a></div><div class="ttdeci">#define N(X)</div><div class="ttdoc">used to generate a compile time uint64_t from the base32 encoded string interpretation of X ...</div><div class="ttdef"><b>Definition:</b> types.hpp:58</div></div>
<div class="ttc" id="group__types_html_gad67b43dc23285b01176f4c181c59fc23"><div class="ttname"><a href="group__types.html#gad67b43dc23285b01176f4c181c59fc23">AccountName</a></div><div class="ttdeci">uint64_t AccountName</div><div class="ttdef"><b>Definition:</b> types.h:24</div></div>
<div class="ttc" id="group__currencyapi_html_ga362f583628aa3e17ea756cb060a94779"><div class="ttname"><a href="group__currencyapi.html#ga362f583628aa3e17ea756cb060a94779">TOKEN_NAME::Transfer::from</a></div><div class="ttdeci">AccountName from</div><div class="ttdef"><b>Definition:</b> currency.hpp:48</div></div>
<div class="ttc" id="group__types_html_gaaa5d1cd013383c889537491c3cfd9aad"><div class="ttname"><a href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a></div><div class="ttdeci">unsigned long long uint64_t</div><div class="ttdef"><b>Definition:</b> types.h:17</div></div>
<div class="ttc" id="token_8hpp_html"><div class="ttname"><a href="token_8hpp.html">token.hpp</a></div><div class="ttdoc">Defines types and ABI for standard token messages and database tables. </div></div>
<div class="ttc" id="group__currencyapi_html_ga1de45851aa74bc1e9b4793dfe99717db"><div class="ttname"><a href="group__currencyapi.html#ga1de45851aa74bc1e9b4793dfe99717db">TOKEN_NAME::getAccount</a></div><div class="ttdeci">Account getAccount(AccountName owner)</div><div class="ttdef"><b>Definition:</b> currency.hpp:106</div></div>
<div class="ttc" id="eos_8hpp_html"><div class="ttname"><a href="eos_8hpp.html">eos.hpp</a></div></div>
<div class="ttc" id="structeos_1_1token_html"><div class="ttname"><a href="structeos_1_1token.html">eosio::token&lt; uint64_t, N(storage)&gt;</a></div></div>
<div class="ttc" id="group__storageapi_html_gabbe71e05a36e97f4844809600c08f432"><div class="ttname"><a href="group__storageapi.html#gabbe71e05a36e97f4844809600c08f432">TOKEN_NAME::StorageTokens</a></div><div class="ttdeci">eosio::token&lt; uint64_t, N(storage)&gt; StorageTokens</div><div class="ttdef"><b>Definition:</b> storage.hpp:36</div></div>
<div class="ttc" id="structeos_1_1token_html_a3daddb64094c45d8f51897aabd44ba3d"><div class="ttname"><a href="structeos_1_1token.html#a3daddb64094c45d8f51897aabd44ba3d">eosio::token::quantity</a></div><div class="ttdeci">NumberType quantity</div><div class="ttdoc">Quantity of tokens available. </div><div class="ttdef"><b>Definition:</b> token.hpp:84</div></div>
<div class="ttc" id="group__storageapi_html_ga7a45c6ffe0972cf0b36332888094d535"><div class="ttname"><a href="group__storageapi.html#ga7a45c6ffe0972cf0b36332888094d535">TOKEN_NAME::getQuotaUsed</a></div><div class="ttdeci">uint64_t getQuotaUsed(AccountName owner)</div><div class="ttdef"><b>Definition:</b> storage.hpp:124</div></div>
<div class="ttc" id="group__types_html_ga06896e8c53f721507066c079052171f8"><div class="ttname"><a href="group__types.html#ga06896e8c53f721507066c079052171f8">uint32_t</a></div><div class="ttdeci">unsigned long uint32_t</div><div class="ttdef"><b>Definition:</b> types.h:18</div></div>
<div class="ttc" id="namespace_t_o_k_e_n___n_a_m_e_html"><div class="ttname"><a href="namespace_t_o_k_e_n___n_a_m_e.html">TOKEN_NAME</a></div><div class="ttdoc">defines transfer struct (abi) </div><div class="ttdef"><b>Definition:</b> currency.cpp:8</div></div>
<div class="ttc" id="struct_t_o_k_e_n___n_a_m_e_1_1_account_html"><div class="ttname"><a href="struct_t_o_k_e_n___n_a_m_e_1_1_account.html">TOKEN_NAME::Account</a></div><div class="ttdoc">row in Account table stored within each scope </div><div class="ttdef"><b>Definition:</b> currency.hpp:62</div></div>
<div class="ttc" id="struct_t_o_k_e_n___n_a_m_e_1_1_transfer_html"><div class="ttname"><a href="struct_t_o_k_e_n___n_a_m_e_1_1_transfer.html">TOKEN_NAME::Transfer</a></div><div class="ttdef"><b>Definition:</b> currency.hpp:44</div></div>
<div class="ttc" id="group__currencyapi_html_ga75350616e02bd681c0e8b12ca4cf7a38"><div class="ttname"><a href="group__currencyapi.html#ga75350616e02bd681c0e8b12ca4cf7a38">TOKEN_NAME::Transfer::to</a></div><div class="ttdeci">AccountName to</div><div class="ttdef"><b>Definition:</b> currency.hpp:52</div></div>
<div class="ttc" id="db_8hpp_html"><div class="ttname"><a href="db_8hpp.html">db.hpp</a></div></div>
<div class="ttc" id="group__storageapi_html_ga459112cbf883226edcb02b35a674ddcd"><div class="ttname"><a href="group__storageapi.html#ga459112cbf883226edcb02b35a674ddcd">TOKEN_NAME::Transfer::quantity</a></div><div class="ttdeci">StorageTokens quantity</div><div class="ttdef"><b>Definition:</b> storage.hpp:57</div></div>
<div class="ttc" id="group__storageapi_html_gaa4d95e1e82c4c995e09e400878511924"><div class="ttname"><a href="group__storageapi.html#gaa4d95e1e82c4c995e09e400878511924">TOKEN_NAME::PACKED</a></div><div class="ttdeci">struct PACKED(Account)</div><div class="ttdoc">row in Account table stored within each scope </div><div class="ttdef"><b>Definition:</b> storage.hpp:63</div></div>
<div class="ttc" id="struct_table_html"><div class="ttname"><a href="struct_table.html">Table</a></div><div class="ttdef"><b>Definition:</b> db.hpp:549</div></div>
<div class="ttc" id="struct_table_html_a50bc5f57482c6a018e7eaf4e716e038c"><div class="ttname"><a href="struct_table.html#a50bc5f57482c6a018e7eaf4e716e038c">Table::get</a></div><div class="ttdeci">static bool get(const PrimaryType &amp;p, Record &amp;r, uint64_t s=scope)</div><div class="ttdef"><b>Definition:</b> db.hpp:748</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
